﻿<%@ Page Title="" Language="C#" theme="default" MasterPageFile="~/MasterPage.master" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Linq" %>

<script runat="server">
    protected void Page_Load(object sender, EventArgs e)
    {
        Page.Title = Resources.faContent.loginPageTitle;
        lLinkForgottenPassword.Text = Resources.faContent.loginLinkFrogottenPasswordText;
        lLinkMembership.Text = Resources.faContent.loginLinkMembershipText;
        lLinkResendActivationMail.Text = Resources.faContent.loginLinkResendActivationMail;
        lHelpTitle.Text = Resources.faContent.loginHelpTitle;
        lHelpItem1.Text = Resources.faContent.loginHelpItem1;
        lHelpItem2.Text = Resources.faContent.loginHelpItem2;
        lHelpItem3.Text = Resources.faContent.loginHelpItem3;
        lHelpItem4.Text = Resources.faContent.loginHelpItem4;
        lHelpItem5.Text = Resources.faContent.loginHelpItem5;
        Literal lUsername = (Literal)Login1.FindControl("lUsername");
        Literal lPassword = (Literal)Login1.FindControl("lPassword");
        CheckBox RememberMe = (CheckBox)Login1.FindControl("RememberMe");
        Button btn = (Button)Login1.FindControl("LoginButton");
        lUsername.Text = Resources.faContent.loginlUsername;
        lPassword.Text = Resources.faContent.loginlPassword;
        RememberMe.Text = Resources.faContent.loginlRememberMe;
        btn.Text = Resources.faContent.loginButtonText;
        Login1.FailureText = "<div class='errorBox'>" + Resources.faContent.loginFaillerMessage + "</div>";
        RequiredFieldValidator rfv = (RequiredFieldValidator)Login1.FindControl("UserNameRequired");
        rfv.ErrorMessage = Resources.faContent.loginRFVErrorUsernameEmptyMsg;
        RequiredFieldValidator prfv = (RequiredFieldValidator)Login1.FindControl("UserNameRequired");
        prfv.ErrorMessage = Resources.faContent.loginRFVErrorPasswordEmtyMsg;
    }

    protected void Login1_LoggedIn(object sender, EventArgs e)
    {
        /*
        if (Roles.GetRolesForUser().ToList<string>().Contains("root"))
        {
            Response.Redirect("~/Admin");
            return;
        }
        else
        {
            Response.Redirect("~/Users/ChangeAccount.aspx");
        }
         * */
    }
</script>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div id="loginbox">
	  <img src="App_Themes/Default/Images/user.png"  alt="" />
	  <asp:Login ID="Login1" runat="server"  style="padding:0px 10px" 
             MembershipProvider="MySqlMembershipProvider" FailureText="" 
            onloggedin="Login1_LoggedIn">							
				<LayoutTemplate>
				<table id="logintable">
				<tr>
				  <td class="ltr2">
    				<asp:Label  CssClass="label"  ID="UserNameLabel"   runat="server" AssociatedControlID="UserName">
                     <asp:Literal runat="server" ID="lUsername" />
    				</asp:Label></td><td>
    				<asp:TextBox  ID="UserName" CssClass="inputclass ltr" runat="server"   />
    				<asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName"
					ErrorMessage=" "  ValidationGroup="Login1">*</asp:RequiredFieldValidator></td></tr><tr>
	              <td class="ltr2">
    				<asp:Label  ID="PasswordLabel" CssClass="label"   runat="server" AssociatedControlID="Password">
                     <asp:Literal runat="server" ID="lPassword" />
    				</asp:Label></td><td>
	                <asp:TextBox  ID="Password" CssClass="inputclass ltr" runat="server"  TextMode="Password"  />
			    	<asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password"
					 ValidationGroup="Login1">*</asp:RequiredFieldValidator></td></tr><tr>
				 <td colspan="2">
				  <asp:CheckBox ID="RememberMe"  runat="server"   />
				 </td>
				</tr>
				<tr>
				 <td colspan="2" class="ltr2">
				  <asp:Button  CssClass="submitbutton"  ID="LoginButton" runat="server" CommandName="Login"   ValidationGroup="Login1"  />  
				 </td>
				</tr>
				<tr>
				 <td colspan="2">
					   <asp:Literal ID="FailureText"  runat="server" EnableViewState="False" />
				  </span>
				 </td>
				</tr>
				</table>
			 </LayoutTemplate>
			 </asp:Login>
			 </div>
			    <div class="helpBox">
      <h4>
       <asp:Literal runat="server" ID="lHelpTitle" />
      </h4>
      <div id="mLogo">
      <ul>
       <li>
         <asp:Literal runat="server" ID="lHelpItem1" />
       </li>
       <li>
         <asp:Literal runat="server" ID="lHelpItem2" />
       </li>
       <li>
         <asp:Literal runat="server" ID="lHelpItem3" />
       </li>
       <li>
         <asp:Literal runat="server" ID="lHelpItem4" />
       </li>
       <li>
         <asp:Literal runat="server" ID="lHelpItem5" />
       </li>
      </ul>
      </div>
      <br />
      <br />
      <center>
      <div >
       <a href="forgottenPassword.aspx" class="button btn2  bbtn btnwidth" >
        <asp:Literal runat="server" ID="lLinkForgottenPassword" />
       </a>
      </div>
      <div>
       <a href="resendActivationMail.aspx" class="button btn2 bbtn btnwidth" >
        <asp:Literal runat="server" ID="lLinkResendActivationMail" />
       </a>
      </div>
      <div>
       <a href="membership.aspx" class="button btn2  bbtn btnwidth"  >
        <asp:Literal runat="server" ID="lLinkMembership" />
       </a>
      </div>
      </center>
      <div class="divspacer" ></div>
     </div>
</asp:Content>

